package com.fz.song.mcos.exceptions;

import com.fz.song.mcos.common.R;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;


/**
 * 全局统一的异常处理
 */
@Slf4j
@RestControllerAdvice
public class GlobalExceptionHandler {

    @ExceptionHandler(McosException.class)
    public R mcosException(McosException ex) {
        return R.fail().code(ex.getCode()).msg(ex.getMessage());
    }
}
